<div class="sidebar-widget default-border">
  <div class="title"><?php echo $heading_title; ?></div>
  <div class="sidebar-widget-content">
    <ul class="category-list">
      <?php foreach ($categories as $category) { ?>
      <li class="<?php echo $category['category_id'] == $category_id ? 'open active' : '' ?>"><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
        <?php if ($category['children']): ?>
        <span class="open-symbol"><i class="fa fa-angle-down" aria-hidden="true"></i></span>
        <div class="sub-category">
          <ul class="sub-category-list">
            <?php foreach ($category['children'] as $child): ?>
            <li class="<?php echo $child['category_id'] == $child_id ? 'open ' : '' ?>"><span></span><a href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a></li>
            <?php endforeach ?>
          </ul>
        </div>
        <?php endif ?>
      </li>
      <?php } ?>
    </ul>
  </div>
</div>